<?php

/**
 * Created by PhpStorm.
 * User: yangwenqu
 * Date: 2018/4/20
 * Time: 15:20
 */
class Account
{
    private $name;
    private $password;
}

$account = new Account();

//$account->name;//Member has private access

class Account2
{
    private $name;
    private $password;

    public function __get($name)
    {
//        print $name . PHP_EOL;
        print  $this->$name . PHP_EOL;
    }

    public function __set($name, $value)
    {
        echo $name . " - " . $value . PHP_EOL;
        $this->{$name} = $value;
    }
}

$account2 = new Account2();
$account2->name;//name
$account2->password;//password
$account2->name = "zing";//name - zing

$account2->id = 2;
$account2->id ;

